﻿/*
 * @Autor: PK
 * @Date: 2021/12/22 20:53:SS
 */

using System.Collections.Generic;
using System.Linq;

namespace ShkSimulation.core.optimization.variable {

	public class DoubleDecisionVariableConverter : DecisionVariableConverter<double> {
		
		public DecisionVariableVector<double> Convert(Dictionary<string, double> inputData) {
			return new DecisionVariableVector<double>(inputData, 0, inputData.Values.Max());
		}

		public Dictionary<string, double> Revert(DecisionVariableVector<double> inputData) {
			Dictionary<string, double> result = new Dictionary<string, double>();
			foreach (var variable in inputData) {
				result.Add(variable.Name, variable.value);
			}
			return result;
		}

	}

}